import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
      title: 'Flutter ListView',
      home: ImageListView(),
    ));

class ListViewDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ListView'),
      ),
      body: ListView(
        children: <Widget>[
          ListTile(
            leading: Icon(Icons.access_time),
            title: Text('access_time'),
          ),
          ListTile(
            leading: Icon(Icons.account_balance),
            title: Text('account_balance'),
          ),
        ],
      ),
    );
  }
}

class ImageListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ImageListView'),
      ),
      body: ListView(
        // scrollDirection: Axis.horizontal,//控制列表的横向或者是纵向
        children: <Widget>[
          Image.network(
              'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=160305517,2880909992&fm=26&gp=0.jpg',
          // fit: BoxFit.fill,//拉伸全屏
          //   fit: BoxFit.contain,//全图显示,原比例还原,可能会有空隙
            fit: BoxFit.cover,//显示可能被拉伸,可能裁剪,充满
          ),
          Image.network(
              'https://05imgmini.eastday.com/mobile/20200908/20200908093154_46b3eecc70b7f38e3b469e9087f77b1b_4_mwpm_03200403.jpg'),
          Image.network(
              'https://05imgmini.eastday.com/mobile/20200908/20200908093154_46b3eecc70b7f38e3b469e9087f77b1b_4_mwpm_03200403.jpg'),
          Image.network(
              'https://05imgmini.eastday.com/mobile/20200908/20200908093154_46b3eecc70b7f38e3b469e9087f77b1b_4_mwpm_03200403.jpg'),

        ],
      ),
    );
  }
}
